"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_assets = require("../../../common/assets.js");
const api_workGuide_index = require("../../../api/workGuide/index.js");
const config_app = require("../../../config/app.js");
if (!Array) {
  const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
  const _easycom_up_gap2 = common_vendor.resolveComponent("up-gap");
  const _easycom_up_toast2 = common_vendor.resolveComponent("up-toast");
  (_easycom_up_input2 + _easycom_up_gap2 + _easycom_up_toast2)();
}
const _easycom_up_input = () => "../../../node-modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_gap = () => "../../../node-modules/uview-plus/components/u-gap/u-gap.js";
const _easycom_up_toast = () => "../../../node-modules/uview-plus/components/u-toast/u-toast.js";
if (!Math) {
  (_easycom_up_input + workGuideMenu + moduleOuterBox + _easycom_up_gap + _easycom_up_toast)();
}
const moduleOuterBox = () => "../../../components/moduleOuterBox/moduleOuterBox.js";
const workGuideMenu = () => "../../../components/workGuideMenu/workGuideMenu.js";
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "home",
  setup(__props) {
    const uToastRef = common_vendor.ref(null);
    const list = common_vendor.ref([]);
    const getWorkGuideList = () => {
      common_vendor.index.showLoading({
        title: "加载中",
        mask: true
      });
      api_workGuide_index.listWorkGuideGroup({}).then((res) => {
        common_vendor.index.hideLoading();
        const { data } = res;
        let arr = data ?? [];
        if (arr.length) {
          list.value = arr.map((item) => {
            item.affairsGuides = item.affairsGuides ?? [];
            if (item.affairsGuides.length) {
              item.affairsGuides = item.affairsGuides.map(
                (child, index) => {
                  child.icon = config_app.imgPrefix + child.logoUrl;
                  child.title = child.itemName;
                  if ((index + 1) % 3 === 1) {
                    child.bgOffset0 = "#fef9ec";
                    child.bgOffset1 = "#fffcf7";
                  }
                  if ((index + 1) % 3 === 2) {
                    child.bgOffset0 = "#F6FFFD";
                    child.bgOffset1 = "#F3FFFB";
                  }
                  if ((index + 1) % 3 === 0) {
                    child.bgOffset0 = "#ECF5FC";
                    child.bgOffset1 = "#F4F8FB";
                  }
                  return child;
                }
              );
            }
            return item;
          });
        }
      }).catch((err) => {
        common_vendor.index.hideLoading();
        uToastRef.value.show({
          type: "error",
          message: err
        });
      });
    };
    const workGuideItemDeatil = (item) => {
      common_vendor.index.navigateTo({
        url: `/subPages/crowd/workGuide/detail?id=${item.id}`
      });
    };
    const toSearch = () => {
      common_vendor.index.navigateTo({ url: "/subPages/crowd/search/index" });
    };
    common_vendor.onLoad(() => {
      getWorkGuideList();
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.o(toSearch),
        b: common_vendor.p({
          color: "#000",
          placeholder: "搜索关键词",
          placeholderStyle: {
            color: "#BBBBBB",
            fontSize: "31rpx"
          },
          prefixIcon: "search",
          prefixIconStyle: "font-size: 50rpx;color: #BBBBBB;",
          shape: "circle",
          border: "surround",
          clearable: true,
          disabled: true,
          disabledColor: "#ffffff"
        }),
        c: common_vendor.o(toSearch),
        d: common_vendor.f(common_vendor.unref(list), (item, index, i0) => {
          return {
            a: common_vendor.o(workGuideItemDeatil, index),
            b: "1aff5051-2-" + i0 + "," + ("1aff5051-1-" + i0),
            c: common_vendor.p({
              menuList: item.affairsGuides
            }),
            d: index,
            e: "1aff5051-1-" + i0,
            f: common_vendor.p({
              moduleTitle: item.itemType,
              moduleIcon: common_vendor.unref(common_assets.ylbzIcon)
            })
          };
        }),
        e: common_vendor.p({
          height: "16"
        }),
        f: common_vendor.sr(uToastRef, "1aff5051-4", {
          "k": "uToastRef"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1aff5051"]]);
wx.createPage(MiniProgramPage);
